--- %%NOBANNER%% -->
![]() | ![]() |
%*--------------------------------------------------------------------------------* | SOURCE: timenote.sas | | | | VERSION: RDS v3.0 | | | | PURPOSE: This macro is designed to record the run time of another macro | | | | SYNTAX: %timenote (macro = _input_dataset_,| | starttime = _output_dataset_) | *--------------------------------------------------------------------------------* ; %macro timenote (macro=,starttime=&starttime) /des='Standard Time Note' ; %local macro starttime notes daymess hourmess minmess andmess secmess ; %*--------------------------------------------------------------* | turn notes off, begin time stamp, globalize and localize all | | variables, calculate key macro variables. | *--------------------------------------------------------------* ; %let notes=%sysfunc(getoption(notes,keyword)) ; options nonotes ; data _null_ ; runtime = datetime() - &starttime ; day = trim(left(put(day(datepart(runtime)) - 1, best.))) ; hour = trim(left(put(hour(runtime), best.))) ; minute = trim(left(put(minute(runtime), best.))) ; second = trim(left(put(round(second (runtime), .01), z5.2))) ; if day = '0' then call symput ('daymess' ,'') ; else call symput ('daymess', ' '||trim(left(day))||' days') ; if hour = '0' then call symput ('hourmess', '') ; else call symput ('hourmess', ' '||trim(left(hour))||' hours') ; if minute = '0' then call symput ('minmess', '') ; else call symput ('minmess', ' '||trim(left(minute))||' minutes') ; if day = '0' and hour = '0' and minute = '0' then call symput ('andmess', '') ; else call symput ('andmess', ' and') ; if second = '00.00' then call symput ('secmess', ' 0.00 seconds') ; else if substr(second, 1, 1) = '0' then call symput ('secmess', ' '||trim(left(substr(second, 2, 4)))||' seconds') ; else call symput ('secmess', ' '||trim(left(second))||' seconds') ; run ; options notes ; %put NOTE: The SPIKEware Macro %upcase(¯o) used %trim(%left(&daymess.&hourmess.&minmess.&andmess.&secmess.)). ; options ¬es ; %mend timenote ;